import 'package:camera/camera.dart';
import 'package:fish_redux/fish_redux.dart';

enum AnswerEditAction {
  initCamera,
  doingOcr,
  doneOcr,
  selectType,
  selectGrade,
  onSubmit,
  onTakePhoto,
  onVoiceAi,
  token,
  onAiSubmit,
  aiCommitted,
  onDemand,
  focus,
}

class AnswerEditActionCreator {
  static Action doingOcr(int index) {
    return Action(AnswerEditAction.doingOcr, payload: index);
  }

  static Action doneOcr(Map<String, String> ocr) {
    return Action(AnswerEditAction.doneOcr, payload: ocr);
  }

  static Action selectType(String item) {
    return Action(AnswerEditAction.selectType, payload: item);
  }

  static Action selectGrade(String item) {
    return Action(AnswerEditAction.selectGrade, payload: item);
  }

  static Action onTakePhoto() {
    return Action(AnswerEditAction.onTakePhoto);
  }

  static Action onVoiceAi(String file) {
    return Action(AnswerEditAction.onVoiceAi, payload: file);
  }

  static Action token(String token) {
    return Action(AnswerEditAction.token, payload: token);
  }

  static Action onAiSubmit() {
    return Action(AnswerEditAction.onAiSubmit);
  }

  static Action onSubmit() {
    return const Action(AnswerEditAction.onSubmit);
  }

  static Action initCamera(
      CameraDescription camera, CameraController controller) {
    return Action(AnswerEditAction.initCamera,
        payload: {'camera': camera, 'controller': controller});
  }

  static Action aiCommitted() {
    return const Action(AnswerEditAction.aiCommitted);
  }

  static Action onDemand() {
    return const Action(AnswerEditAction.onDemand);
  }

  static Action focus(bool hasFocus) {
    return Action(AnswerEditAction.focus, payload: hasFocus);
  }
}
